<div>
  <div class="main-title">
    <h2>{if $id}编辑{else}新增{/if}房号</h2>
  </div>
  <div class="main-section">
    <form method="POST" action="{:url('save')}" class="j-form form-horizontal">
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">房产</label>
        <input type="text" class="form-control col-sm-10" name="house_property_name" value="{$data.house_property_name}"
          data-toggle="tooltip" data-placement="top" required readonly>
        <label class="col-sm-2 control-label">房号</label>
        <input type="text" class="form-control col-sm-10" name="house_number_name" value="{$data.house_number_name}"
          data-toggle="tooltip" data-placement="top" required readonly>
      </div>
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">上月电表度数</label>
        <input type="text" class="form-control col-sm-10" name="electricity_meter_last_month"
          value="{$data.electricity_meter_last_month}" data-toggle="tooltip" data-placement="top" required>
        <label class="col-sm-2 control-label">上月水表度数</label>
        <input type="text" class="form-control col-sm-10" name="water_meter_last_month"
          value="{$data.water_meter_last_month}" data-toggle="tooltip" data-placement="top" required>
      </div>
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">抄表时间</label>
        <input type="text" class="form-control col-sm-10" name="meter_reading_time"
          value="{$data.meter_reading_time|default=time()|date='Y-m-d'}" data-toggle="tooltip" data-placement="top"
          required>
      </div>
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">本月电表度数</label>
        <input type="text" class="form-control col-sm-10" name="electricity_meter_this_month"
          value="{$data.electricity_meter_this_month}" data-toggle="tooltip" data-placement="top" required>
        <label class="col-sm-2 control-label">本月水表度数</label>
        <input type="text" class="form-control col-sm-10" name="water_meter_this_month"
          value="{$data.water_meter_this_month}" data-toggle="tooltip" data-placement="top" required>
      </div>
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">租金</label>
        <input type="text" class="form-control col-sm-10" name="rental" value="{$data.rental}" data-toggle="tooltip"
          data-placement="top" required>
        <label class="col-sm-2 control-label">押金</label>
        <input type="text" class="form-control col-sm-10" name="deposit" value="{$data.deposit}" data-toggle="tooltip"
          data-placement="top" required>
      </div>
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">垃圾费</label>
        <input type="text" class="form-control col-sm-10" name="garbage_fee" value="{$data.garbage_fee}"
          data-toggle="tooltip" data-placement="top" required>
        <label class="col-sm-2 control-label">其他费用</label>
        <input type="text" class="form-control col-sm-10" name="other_charges" value="{$data.other_charges}"
          data-toggle="tooltip" data-placement="top" required>
      </div>
      <div class="form-group form-inline">
        <label class="col-sm-2 control-label">备注</label>
        <textarea class="form-control" style="min-width: 43%" rows="3" name="note" data-toggle="tooltip"
          data-placement="top">{$data.note}</textarea>
      </div>
      <div class="form-group form-inline">
        <div class="col-sm-2"></div>
        <input type="hidden" name="id" value="{$id}">
        <input type="hidden" name="house_number_id" value="{$data.house_number_id}">
        <input type="hidden" name="house_property_id" value="{$data.house_property_id}">
        <input type="submit" value="提交表单" class="btn btn-primary">
        <a href="{:url('index', ['house_property_id' => $data.house_property_id])}" class="btn btn-default">返回列表</a>
      </div>
    </form>
  </div>
</div>

<script>
  main.ajaxForm('.j-form', function () {
    main.content("{:url('index', ['house_property_id' => $data.house_property_id])}");
  });
  $('[data-toggle="tooltip"]').tooltip();
</script>